#ifndef __FLASH_H__
#define __FLASH_H__


#include <stdint.h>
#include "main.h"
// #define LED_STATUS_ADDR  0x08100000  // Sector 7 start address
// #define LED_ON           0x00000000
// #define LED_OFF          0x00000001

#define ADDR_FLASH_SECTOR_0     ((uint32_t)0x08000000) /* 128 Kbytes */
#define ADDR_FLASH_SECTOR_1     ((uint32_t)0x08020000) /* 128 Kbytes */
#define ADDR_FLASH_SECTOR_2     ((uint32_t)0x08040000) /* 128 Kbytes */
#define ADDR_FLASH_SECTOR_3     ((uint32_t)0x08060000) /* 128 Kbytes */
#define ADDR_FLASH_SECTOR_4     ((uint32_t)0x08080000) /* 128 Kbytes */
#define ADDR_FLASH_SECTOR_5     ((uint32_t)0x080A0000) /* 128 Kbytes */
#define ADDR_FLASH_SECTOR_6     ((uint32_t)0x080C0000) /* 128 Kbytes */
#define ADDR_FLASH_SECTOR_7     ((uint32_t)0x080E0000) /* 128 Kbytes */

#define FLASH_USER_START_ADDR   (ADDR_FLASH_SECTOR_6 - 32)     // Start address of user Flash area
#define FLASH_USER_END_ADDR     ((uint32_t)0x080FFFFF)  // End address of user Flash area

HAL_StatusTypeDef STM32Flash_Write(uint32_t Address, uint8_t* Data, uint32_t Length);
HAL_StatusTypeDef STM32Flash_Read(uint32_t Address, uint8_t* Data, uint32_t Length);

#endif // __FLASH_H__
